package com.zishuimuyu.mqtt;

import lombok.extern.slf4j.Slf4j;
import org.eclipse.paho.client.mqttv3.IMqttMessageListener;
import org.eclipse.paho.client.mqttv3.MqttMessage;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Component;

/**
 * @author 向佩环
 * @description mqtt数据监听，异步解析
 * @company 北京木联能软件股份有限公司
 * @date 2022/9/9
 */
@Component
@Slf4j
public class MqttMessageListener implements IMqttMessageListener {


    @Override
    @Async("threadPoolTaskExecutor")
    public void messageArrived(String topic, MqttMessage mqttMessage) throws Exception {
        log.info("mqtt数据监听：{}", mqttMessage.toString());
    }

}
